/*
#include <stdio.h>

void test();

void test() {
    printf("test01\n");
}

int main() {
    test();
}
*/

/*
#include <stdio.h>

void test();

void test() {
    printf("test02\n");
}

int main() {
    void (*f)() = test;
    (*f)();
    f();
}
*/

/*
#include <stdio.h>

int add(int x, int y);

int add(int x, int y) {
    return x + y;
}

int main() {
    int (*f)(int, int) = add;
    int sum1 = (*f)(10, 90);
    int sum2 = f(100, 900);
    printf("sum1=%d\n",  sum1);
    printf("sum2=%d\n",  sum2);
}
*/

#include <stdio.h>

int add(int x, int y);
int sub(int x, int y);
int run(int (*f)(int, int), int x, int y);

int add(int x, int y) {
    return x + y;
}

int sub(int x, int y) {
    return x - y;
}

int run(int (*f)(int, int), int x, int y) {
    return (*f)(x, y);
}

int main() {
    int a = run(add, 10, 90);
    int b = run(sub, 100, 90);
    printf("a=%d\n", a);
    printf("b=%d\n", b);
}

/*
1.函数名会被隐式地转换为函数指针
2.解引用符*和取地址符&用在函数名之前基本上都是多余的
*/